package zjimu1.test;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;


public class FlourAll {

	int[][] arrary;
	int arraryLength;
	int arraryWidth;
	FlourOne cube;
	public FlourAll()
	{
		cube=new FlourOne(10000,-10000,10000);
	}
	public void InitFlourArrary(int[][] arrary,int arraryLength, int arraryWidth)
	{
		this.arrary=arrary.clone();
		this.arraryLength=arraryLength;
		this.arraryWidth=arraryWidth;
	}
	public void InitFlourArrary2()
	{
		this.arrary=new int[][]{
			{1,1,1,1,1},
			{1,0,0,0,0},
			{1,1,1,1,1},
			{1,1,1,0,0},
			{1,1,1,1,1}
			
		};
		this.arraryLength=5;
		this.arraryWidth=5;
	}
	int angle=0;
	public void DrawFlour(GL10 gl)
	{
		
		for(int i=0;i<this.arraryLength;i++)
		{
			for(int j=0;j<this.arraryWidth;j++)
			{
				if(this.arrary[i][j]==1)
				{
					cube.InitDraw(gl);
					cube.InitMatrix(gl);					
					//gl.glRotatef(angle, 0, 1, 0);
					//gl.glRotatef(angle, 0, 1, 0);					
					cube.SetPossion(i*10000, -4000,j*10000, gl);					
					cube.OverDraw(gl);
					cube.PopMatrix(gl);	
				}
			}
		}
		angle++;
	}
}
